package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"project_base_framework/controller"
	"project_base_framework/utils"
)

func initRouter(engine *gin.Engine) {
	userController := controller.NewUserController()
	engine.POST("/user/login", userController.Login)
}

func main() {
	err := utils.InitDB("root", "root", "127.0.0.1:3306", "ruoyi-go")
	if err != nil {
		fmt.Println("get database connect fail", err.Error())
		return
	}
	engine := gin.Default()
	initRouter(engine)
	err = engine.Run(":8080")
	if err != nil {
		fmt.Println("gin start fail, err =", err.Error())
		return
	}
}
